package com.wholesale.beans;


import org.json.JSONException;
import org.json.JSONObject;

public class OrderTrackingInfo {

	private String invoiceNo ;
	private int orderId ;
	private String orderSn ;
	private String orderTime ;
	private String paymentTime ;
	private int shippingId ;
	private String shippingName ;
	private int shippingStatus ;
	private String shippingTime ;
	private JSONObject jsonObject;
	public String getInvoiceNo() {

		return invoiceNo;
	}
	public void setInvoiceNo(String invoiceNo) {
		this.invoiceNo = invoiceNo;
	}
	public int getOrderId() {
		return orderId;
	}
	public void setOrderId(int orderId) {
		this.orderId = orderId;
	}
	public String getOrderSn() {

		return orderSn;
	}
	public void setOrderSn(String orderSn) {
		this.orderSn = orderSn;
	}
	public String getOrderTime() {
		
		return orderTime;
	}
	public void setOrderTime(String orderTime) {
		this.orderTime = orderTime;
	}
	public String getPaymentTime() {
		return paymentTime;
	}
	public void setPaymentTime(String paymentTime) {
		this.paymentTime = paymentTime;
	}
	public int getShippingId() {
		return shippingId;
	}
	public void setShippingId(int shippingId) {
		this.shippingId = shippingId;
	}
	public String getShippingName() {
		return shippingName;
	}
	public void setShippingName(String shippingName) {
		this.shippingName = shippingName;
	}
	public int getShippingStatus() {
		return shippingStatus;
	}
	public void setShippingStatus(int shippingStatus) {
		this.shippingStatus = shippingStatus;
	}
	public String getShippingTime() {
		return shippingTime;
	}
	public void setShippingTime(String shippingTime) {
		this.shippingTime = shippingTime;
	}
	
	public String getShippingStatusName() {
		if (shippingStatus == 0) {
			return "Unshipped";
		} else if (shippingStatus == 1) {
			return "Shipped";
		} else if (shippingStatus == 2) {
			return "Has been receiving";
		} else if (shippingStatus == 3) {
			return "Stocking in";
		} else if (shippingStatus == 4) {
			return "Rreturn of goods";
		} else {
			return "Unknown";
		}
	}
	
	public void jsonAnalytic(String jsonString){
		
		try {
			jsonObject = new JSONObject(jsonString);
			jsonAnalytic(jsonObject);
		} catch (JSONException e) {
			
		}
	}
	
	public void jsonAnalytic(JSONObject jsonObject){
		this.jsonObject = jsonObject;
	
			try {
				orderSn = jsonObject.getString("orderSn");
			} catch (JSONException e) {
			}
			try {
				orderId = jsonObject.getInt("orderId");
			} catch (JSONException e) {
			}
			try {
				shippingId = jsonObject.getInt("shippingId");
			} catch (JSONException e) {
			}
			try {
				shippingName = jsonObject.getString("shippingName");
			} catch (JSONException e) {
			}
			try {
				shippingStatus = jsonObject.getInt("shippingStatus");
			} catch (JSONException e) {
			}
			try {
				orderTime = jsonObject.getString("orderTime");
			} catch (JSONException e) {
			}
			try {
				paymentTime = jsonObject.getString("paymentTime");
			} catch (JSONException e) {
				paymentTime = null ;
			}
			try {
				shippingTime = jsonObject.getString("shippingTime");
			} catch (JSONException e) {
				shippingTime = null ;
			}
			try {
				invoiceNo = jsonObject.getString("invoiceNo");
			} catch (JSONException e) {
			}
		
	}
}
